package com.xinqi.modules.exam.student.manager;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xinqi.common.mybatis.data.service.BaseService;
import com.xinqi.modules.exam.paper.dto.rsp.CourseExamPaperStatsDataDTO;
import com.xinqi.modules.exam.student.domain.CourseExamPaperStudentEntity;
import com.xinqi.modules.exam.student.dto.req.CourseExamPaperStudentQueryDTO;
import com.xinqi.modules.exam.student.dto.rsp.CourseExamPaperStudentListDTO;
import com.xinqi.modules.exam.student.dto.rsp.CourseExamPaperStudentResultDTO;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 课程测评学生答题管理层
 *
 * @author: linkai
 * @date: 2023/07/02
 */
public interface CourseExamPaperStudentManager extends BaseService<CourseExamPaperStudentEntity> {

    /**
     * 自定义分页查询
     */
    Page<CourseExamPaperStudentResultDTO> findPage(Page<Object> page, CourseExamPaperStudentQueryDTO query);

    /**
     * 自定义列表查询
     */
    List<CourseExamPaperStudentResultDTO> findList(CourseExamPaperStudentQueryDTO query);

    /**
     * 根据id查询 课程测评学生答题数据
     */
    CourseExamPaperStudentEntity findById(Long id);

    /**
     * 根据id删除 课程测评学生答题数据
     */
    @Transactional(rollbackFor = Exception.class)
    boolean deleteById(Long id);

    CourseExamPaperStudentEntity findByExamIdAndStudentId(Long examId, Long studentId);

    @Transactional(rollbackFor = Exception.class)
    boolean updateRejectPaper(Long examId, List<Long> studentIdList);

    @Transactional(rollbackFor = Exception.class)
    boolean updateRejectPaperByIds(List<Long> studentPaperIdList);

    List<Long> findStudentIdByNotPaper(Long examId);

    List<CourseExamPaperStudentEntity> findByExamId(Long examId);

    boolean isAllMark(Long examId);

    boolean isGenerated(Long examId);

    List<CourseExamPaperStudentListDTO> findStudentList(CourseExamPaperStudentQueryDTO dto);

    IPage<CourseExamPaperStudentListDTO> pageStudentList(Page<Object> page, CourseExamPaperStudentQueryDTO dto);

    CourseExamPaperStudentEntity findRandStudent(Long examId);

    CourseExamPaperStatsDataDTO findStats01(Long examId);

    @Transactional(rollbackFor = Exception.class)
    Boolean updateNotCommitPaperStatus(Long examId);

    List<Long> findRejectPaper(Long examPaperId, List<Long> studentIdList);

    List<Long> findStudentIdByExamId(Long examId);

    @Transactional(rollbackFor = Exception.class)
    Boolean deleteByUserIds(List<Long> userIdList);

    List<Long> findExamIdByStudentId(List<Long> userIdList);
}
